/*
* Copyright 2010 ANDAGO INGENIERIA S.L.
*
* Licensed under the EUPL, Version 1.1 only (the "Licence");
* You may not use this work except in compliance with the
* Licence.
* You may obtain a copy of the Licence at:
*
* http://ec.europa.eu/idabc/eupl
*
* Unless required by applicable law or agreed to in
* writing, software distributed under the Licence is
* distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the Licence for the specific language governing
* permissions and limitations under the Licence.
*/

package com.andago.alohaui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.widget.Button;



public class MenuMonitoring extends Activity {
	/** Called when the activity is first created. */
	
	static final private int GET_CODE = 0;
	protected static final String LOG_TAG = "Submenu_monitorizacion";

	private Button botonFormulario;
	private Button botonVideoconferencia;
	private Button botonConexionDispositivos;
	
	@Override
	public void onCreate(Bundle icicle) {
		
		super.onCreate(icicle);
		// Para poner el icono de la aplicacion arriba, en la barra superior.
		Window w = getWindow();
		w.requestFeature(Window.FEATURE_LEFT_ICON);
		setContentView(R.layout.menu_monitoring);
		w.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.icono_aplicacion_barrasup);

		botonFormulario = (Button) findViewById(R.id.boton_monitorizacion_formulario);
		botonFormulario.setOnFocusChangeListener(botonCambiadoFormulario);
		botonFormulario.setOnClickListener(botonPulsadoFormulario);

		botonVideoconferencia = (Button) findViewById(R.id.boton_monitorizacion_videoconferencia);
		botonVideoconferencia.setOnFocusChangeListener(botonCambiadoVideoconferencia);
		botonVideoconferencia.setOnClickListener(botonPulsadoVideoconferencia);

		botonConexionDispositivos = (Button) findViewById(R.id.boton_monitorizacion_conexion_dispositivos);
		botonConexionDispositivos.setOnFocusChangeListener(botonCambiadoConexionDispositivos);
		botonConexionDispositivos.setOnClickListener(botonPulsadoConexionDispositivos);
	}
	
	 private OnFocusChangeListener botonCambiadoFormulario = new OnFocusChangeListener(){
		 public void onFocusChange(View v, boolean b){
			if (b == true)
			{
			 	((Button)findViewById(R.id.boton_monitorizacion_formulario)).setBackgroundResource(R.drawable.fondo_menu_rollover); 
			}
			else
			{
			 	((Button)findViewById(R.id.boton_monitorizacion_formulario)).setBackgroundResource(R.drawable.fondo_menu); 
			}
		 }
	 };

	 private OnFocusChangeListener botonCambiadoVideoconferencia = new OnFocusChangeListener(){
		 public void onFocusChange(View v, boolean b){
			if (b == true)
			{
			 	((Button)findViewById(R.id.boton_monitorizacion_videoconferencia)).setBackgroundResource(R.drawable.fondo_menu_rollover); 
			}
			else
			{
			 	((Button)findViewById(R.id.boton_monitorizacion_videoconferencia)).setBackgroundResource(R.drawable.fondo_menu); 
			}
		 }
	 };

	 private OnFocusChangeListener botonCambiadoConexionDispositivos = new OnFocusChangeListener(){
		 public void onFocusChange(View v, boolean b){
			if (b == true)
			{
			 	((Button)findViewById(R.id.boton_monitorizacion_conexion_dispositivos)).setBackgroundResource(R.drawable.fondo_menu_rollover); 
			}
			else
			{
			 	((Button)findViewById(R.id.boton_monitorizacion_conexion_dispositivos)).setBackgroundResource(R.drawable.fondo_menu); 
			}
		 }
	 };

	 private OnClickListener botonPulsadoFormulario = new OnClickListener(){
		 public void onClick(View v){		
			 //startActivityForResult(new Intent(MenuMonitoring.this, FormularioToxicidad.class),GET_CODE);
		 }
	 };

	 private OnClickListener botonPulsadoVideoconferencia = new OnClickListener(){
		 public void onClick(View v){		
			 //startActivityForResult(new Intent(MenuMonitoring.this, VideoConferencia.class),GET_CODE);
		 }
	 };

	 private OnClickListener botonPulsadoConexionDispositivos = new OnClickListener(){
		 public void onClick(View v){			 
			 startActivityForResult(new Intent(MenuMonitoring.this, AlohaMainUI.class),GET_CODE);
		 }
	 };

	 
}	 
